package com.huangmb.anymark.server.model;

import javax.persistence.*;
import java.io.Serializable;

/**
 * @author hmb
 * @version 1.0
 * @since 2016/5/4 17:03
 */
@Entity
@Table(name = "marker",catalog = "anymark")

public class Marker implements Serializable {
    private int id;
    private String mTitle;
    private String mInfo;
    private String mCoverImage;
    private Category mCategory;
    private int mCreateTime;
    private double mLatitude;
    private double mLongitude;
    private String mAddress;
    private User mUser;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id",unique = true,nullable = false)
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Column(name = "title",nullable = false,length = 50)
    public String getTitle() {
        return mTitle;
    }

    public void setTitle(String title) {
        this.mTitle = title;
    }

    @Column(name = "info",nullable = false)
    public String getInfo() {
        return mInfo;
    }

    public void setInfo(String info) {
        this.mInfo = info;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "category_id",nullable = false)
    public Category getCategory() {
        return mCategory;
    }

    public void setCategory(Category category) {
        mCategory = category;
    }

    @Column(name = "create_time",nullable = false)
    public int getCreateTime() {
        return mCreateTime;
    }

    public void setCreateTime(int createTime) {
        this.mCreateTime = createTime;
    }

    @Column(name = "latitude",nullable = false)
    public double getLatitude() {
        return mLatitude;
    }

    public void setLatitude(double latitude) {
        this.mLatitude = latitude;
    }

    @Column(name = "longitude",nullable = false)
    public double getLongitude() {
        return mLongitude;
    }

    public void setLongitude(double longitude) {
        this.mLongitude = longitude;
    }

    @Column(name = "address",length = 50,nullable = true)
    public String getAddress() {
        return mAddress;
    }

    public void setAddress(String address) {
        this.mAddress = address;
    }

    @Column(name = "cover",nullable = true)
    public String getCoverImage() {
        return mCoverImage;
    }

    public void setCoverImage(String coverImage) {
        mCoverImage = coverImage;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "user_id",nullable = false)
    public User getUser() {
        return mUser;
    }

    public void setUser(User user) {
        mUser = user;
    }
}
